#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;

int lengthOfLongestSubstring(char* s) {
    if (*s == (char)" ")
    {
        return 1;
    }
    char* left = s;
    char* right = s + 1;
    int max = 0;
    int i = 0;
    while (*s)
    {
        char* tmp = left;
        i = 1;
        int flag = 1;
        while (*right && tmp < right)
        {
            if (*right == *tmp)
            {
                left = tmp;
                flag = 0;
                break;
            }
            else
            {
                tmp++;
                i++;
            }
        }
        if (flag)
        {
            s++;
            right++;
        }
        else
        {
            left++;
        }
        if (max < i)
        {
            max = i;
        }
        
    }
    return max;
}

int main()
{
    char a[] = "bbtablud";
    cout << lengthOfLongestSubstring(a) << endl;
	return 0;
}